package gaml.yaml;

import java.util.ArrayList;
import java.util.HashMap;


/**
 * list type yaml node
 * @author shnireck_vi
 *
 */
public class SequenceNode extends YamlNode {
	ArrayList <YamlNode> children = new ArrayList <YamlNode> ();
	
	public SequenceNode (YamlNode parent) {
		this.parent = parent;
		if (null != parent) level = parent.getLevel () + 1;
	}

	@Override
	public YamlNode addChild (YamlNode value) {
		children.add (value);
		return this;
	}

	@Override
	public YamlNode addChild (YamlNode key, YamlNode val) { return this; }
	
	@Override
	public ArrayList <YamlNode> getSequenceChildren () { return children; }

	@Override
	public HashMap <YamlNode, YamlNode> getMappingChildren () { return new HashMap <YamlNode, YamlNode> (); }

	@Override
	public String getValue () { return null; }

	@Override
	public YamlNode setValue (String value) { return this; }

	@Override
	public YamlNode getChild (YamlNode key) { return null; }

	@Override
	public YamlNode getChild (int index) { return children.get (index); }

	@Override
	public boolean isEmpty () { return getSequenceChildren ().isEmpty (); }
}
